<?php
//增加商品类
namespace app\admin\model;
use think\Model;
use think\Db;
class Sfenlei extends Model
{
	//查询商品分类$fid为真时查子类,否则查第一大类
	public function select2($fid = null)
	{
		if ($fid) {
			return $this->where('prev_id',$fid)->select();
		}else{
			return $this->where('prev_id',0)->select();
		}
	}
	//查询优惠劵的信息
	public function select3()
	{
		
		return $this->name('syouhuijuan')->select();
		
	}
	public function insert2($data)
	{	
		$this->data($data);
		$result = $this->save();
		if ($result) {
			return true;
		}else{
			return false;
		}
	}

}
